package com.springboot.frame.web.page;

/**
 * @author madman
 * @version 1.0
 * @date 2019/7/9 15:38
 */
public class Page {
    private int startIndex;
    private int pageShowCount;

    public Page(int pageShowCount,int currentPage) {
        this.startIndex = getBeginIndex(pageShowCount,currentPage);
        this.pageShowCount = pageShowCount;
    }

    public int getStartIndex() {
        return startIndex;
    }

    public void setStartIndex(int startIndex) {
        this.startIndex = startIndex;
    }

    public int getPageShowCount() {
        return pageShowCount;
    }

    public void setPageShowCount(int pageShowCount) {
        this.pageShowCount = pageShowCount;
    }

    private static int getBeginIndex(int pageShowCount, int currentPage) {
        return (currentPage - 1) * pageShowCount;
    }
}
